/*
<Copyright (C) 2011 Dru Moore>

This file is part of demorecorder.

vlc-remote is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

demorecorder is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with demorecorder.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MIXERPIPELINE_H
#define MIXERPIPELINE_H

#include <QObject>
#include <QString>
#include "gst/gst.h"

class MixerPipeline : public QObject
{
    Q_OBJECT
public:
    explicit MixerPipeline(QObject *parent = 0);
    MixerPipeline(QObject *parent = 0, QString name = "");

signals:
    void position_duration(long long position, long long duration);
    void end_of_stream();
    void stream_error(QString msg);

public slots:
    bool add_track(QString name, GstElement *track);
    bool remove_track(QString name);
    bool remove_track(GstElement *track);
    static gboolean bus_callback(GstBus *bus, GstMessage *message, void* data);
    //static gboolean pad_added(GstElement* comp, GstPad* srcPad, MixerPipeline* data);
    void get_duration_info();
    void play();
    void pause();
    void stop();
    void seekTo(long long position);

private:
    void construct_pipeline();
    long long get_current_time();

    GstPipeline *pipeline;
    GstElement *adder;
    GstElement *volume;
    GstElement *panorama;
    GstElement *audio_sink;
    GstQuery *duration_query;
    GstQuery *position_query;
    QString name;
    long long position;
    long long duration;

};

#endif // MIXERPIPELINE_H
